<?php
 /*
  * 这个是获取 发布需求的类型
  */
global $_GPC, $_W; 
 
$uniacid = $this->_uniacid;
$uid = $_W['member']['uid']; 
$openid = $_W['openid'];
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
/*默认类类型*/
$dfault = [  0=>'新房楼盘' , 1=>'二手房',2=>'写字楼',3=>'商铺',4=>'生意转让',5=>'厂房',6=>'仓库'   ];
 
if($operation =='display'){
    $housetype = [];
    $ret = pdo_fetchall("select * from ".  tablename("kbwdl_config")." where uniacid='$uniacid' and placeid=11 and module='kbwdl_shequzufang'");
    if(is_array($ret)){
        foreach($ret as $key =>$val){
            $params[$val['confkey']] = iunserializer($val['conf_value']);
        }
    }
    if(isset( $params['confmenu']['need_radio_open'] ) &&  $params['confmenu']['need_radio_open']==1 ){
      
        if(isset( $params['confmenu']['ngtype_newhouse'] ) &&  $params['confmenu']['ngtype_newhouse']==1 ){
            $housetype[0] = '新房楼盘';
        }
        if(isset( $params['confmenu']['ngtype_house'] ) &&  $params['confmenu']['ngtype_house']==1 ){
            $housetype[1] = '二手房';
        }
        if(isset( $params['confmenu']['ngtype_xie'] ) &&  $params['confmenu']['ngtype_xie']==1 ){
            $housetype[2] = '写字楼';
        }
        if(isset( $params['confmenu']['ngtype_sp'] ) &&  $params['confmenu']['ngtype_sp']==1 ){
            $housetype[3] = '商铺';
        }
        if(isset( $params['confmenu']['ngtype_sy'] ) &&  $params['confmenu']['ngtype_sy']==1 ){
            $housetype[4] = '生意转让';
        }
        if(isset( $params['confmenu']['ngtype_changfang'] ) &&  $params['confmenu']['ngtype_changfang']==1 ){
            $housetype[5] = '厂房';
        }
        if(isset( $params['confmenu']['ngtype_cangku'] ) &&  $params['confmenu']['ngtype_cangku']==1 ){
            $housetype[6] = '仓库';
        }
    }
    if(empty(  $housetype )){
        $housetype = $dfault;        
    }
    $str = [];
    foreach($housetype as $key=>$val){
         $str[] = ['value'=>$key, 'name'=> $val, 'checked'=> false ];
    }
    /*默认选中第一个*/
    $str[0]['checked'] = true;
    
    $this->result(0, '', $str);
}
?>
